//
//  PHMenuViewController.m
//  Demo2
//
//  Created by Ta Phuoc Hai on 2/12/14.
//  Copyright (c) 2014 Phuoc Hai. All rights reserved.
//

#import "PHMenuViewController.h"
#import "PHMainViewController.h"
#import "PHSecondViewController.h"

@implementation PHMenuViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"背景-"]];
    

}

#pragma mark - PHAirMenuDelegate & DataSource

- (NSInteger)numberOfSession
{
    return 3;
}

- (NSInteger)numberOfRowsInSession:(NSInteger)sesion
{
    switch (sesion) {
        case 0  :
            return 2;
            break;
        case 1 :
            return 4;
            break;
        case 2 :
            return 3;
            break;
        default:
            break;
    }
    return 0;
}

- (NSString*)titleForRowAtIndexPath:(NSIndexPath*)indexPath
{

    switch ( indexPath.section ) {
        case 0:
            switch (indexPath.row) {
                case 0:
                    return @"精选故事";
                    break;
                case 1:
                    return @"酷拉丁天使";
                    break;
                default:
                    break;
            }
            
            break;
        case 1:
            switch (indexPath.row) {
                case 0:
                    return @"设计师";
                    break;
                case 1:
                    return @"施工队";
                    break;
                case 2:
                    return @"精品套餐";
                    break;
                case 3:
                    return @"我的需求";
                    break;
                default:
                    break;
            }
            break;
        case 2:
            switch (indexPath.row) {
                case 0:
                    return @"装修日记";
                    break;
                case 1:
                    return @"我的账单";
                    break;
                case 2:
                    return @"我的设计";
                    break;

                default:
                    break;
            }
            break;
        default:
            break;
    }
    return @"";
}

- (NSString*)titleForHeaderAtSession:(NSInteger)session
{
    switch ( session) {
        case 0:
            return  @"开始";
            break;
        case 1:
            return  @"发现";
            break;
        case 2:
            return  @"记录";
            break;
        default:
            break;
    }
    return @"";
}

- (UIViewController*)viewControllerForIndexPath:(NSIndexPath*)indexPath
{

    UIViewController *viewController;
    UINavigationController * controller;
    switch (indexPath.section) {
        case 0:
            
            switch (indexPath.row) {
                case 0:
                {
                    viewController = [[PHMainViewController alloc] init];
                    controller = [[UINavigationController alloc] initWithRootViewController:viewController];
                    break;
                }
                case 1:
                {
                    viewController = [[PHSecondViewController alloc] init];
                    controller = [[UINavigationController alloc] initWithRootViewController:viewController];
                    break;
                }
                default:
                    break;
            }

            break;
        case 1:
            viewController = [[PHSecondViewController alloc] init];
            controller = [[UINavigationController alloc] initWithRootViewController:viewController];

            break;
        case 2:
            viewController = [[PHSecondViewController alloc] init];
            controller = [[UINavigationController alloc] initWithRootViewController:viewController];

            break;
    }
    return controller;
}

@end
